/*     */ package com.zimbra.qa.unittest.prov.ldap;
/*     */ 
/*     */ import com.google.common.collect.Maps;
/*     */ import com.zimbra.common.account.Key.AccountBy;
/*     */ import com.zimbra.common.account.Key.DistributionListBy;
/*     */ import com.zimbra.common.util.StringUtil;
/*     */ import com.zimbra.cs.account.Account;
/*     */ import com.zimbra.cs.account.AccountServiceException;
/*     */ import com.zimbra.cs.account.DistributionList;
/*     */ import com.zimbra.cs.account.Domain;
/*     */ import com.zimbra.cs.account.Provisioning;
/*     */ import com.zimbra.cs.account.Server;
/*     */ import com.zimbra.qa.QA.Bug;
/*     */ import com.zimbra.qa.unittest.TestUtil;
/*     */ import com.zimbra.qa.unittest.prov.Names;
/*     */ import com.zimbra.qa.unittest.prov.Verify;
/*     */ import com.zimbra.soap.admin.type.CacheEntryType;
/*     */ import java.util.HashMap;
/*     */ import java.util.HashSet;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.Set;
/*     */ import org.junit.AfterClass;
/*     */ import org.junit.Assert;
/*     */ import org.junit.BeforeClass;
/*     */ import org.junit.Test;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class TestLdapProvDistributionList
/*     */   extends LdapTest
/*     */ {
/*     */   private static LdapProvTestUtil provUtil;
/*     */   private static Provisioning prov;
/*     */   private static Domain domain;
/*     */   private static String BASE_DOMAIN_NAME;
/*     */   
/*     */   @BeforeClass
/*     */   public static void init()
/*     */     throws Exception
/*     */   {
/*  54 */     provUtil = new LdapProvTestUtil();
/*  55 */     prov = provUtil.getProv();
/*  56 */     domain = provUtil.createDomain(baseDomainName(), null);
/*  57 */     BASE_DOMAIN_NAME = domain.getName();
/*     */   }
/*     */   
/*     */   @AfterClass
/*     */   public static void cleanup() throws Exception {
/*  62 */     Cleanup.deleteAll(new String[] { baseDomainName() });
/*     */   }
/*     */   
/*     */   private DistributionList createDistributionList(String localpart) throws Exception {
/*  66 */     return createDistributionList(localpart, null);
/*     */   }
/*     */   
/*     */   private DistributionList createDistributionList(String localPart, Map<String, Object> attrs) throws Exception
/*     */   {
/*  71 */     return provUtil.createDistributionList(localPart, domain, attrs);
/*     */   }
/*     */   
/*     */   private void deleteDistributionList(DistributionList dl) throws Exception {
/*  75 */     provUtil.deleteDistributionList(dl);
/*     */   }
/*     */   
/*     */   private Account createAccount(String localPart) throws Exception {
/*  79 */     return createAccount(localPart, null);
/*     */   }
/*     */   
/*     */   private Account createAccount(String localPart, Map<String, Object> attrs) throws Exception
/*     */   {
/*  84 */     return provUtil.createAccount(localPart, domain, attrs);
/*     */   }
/*     */   
/*     */   private void deleteAccount(Account acct) throws Exception {
/*  88 */     provUtil.deleteAccount(acct);
/*     */   }
/*     */   
/*     */   private void verifyEquals(Set<String> expectedNames, List<DistributionList> actual) throws Exception
/*     */   {
/*  93 */     Assert.assertEquals(expectedNames.size(), actual.size());
/*  94 */     Set<String> actualIds = new HashSet();
/*  95 */     for (DistributionList group : actual) {
/*  96 */       actualIds.add(group.getName());
/*     */     }
/*  98 */     Verify.verifyEquals(expectedNames, actualIds);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   private void verifyMembership(String acctId, Set<String> expectedAllGroups, Set<String> expectedDirectGroups)
/*     */     throws Exception
/*     */   {
/* 107 */     for (int i = 0; i < 2; i++) {
/* 108 */       Account acct = prov.get(Key.AccountBy.id, acctId);
/*     */       
/* 110 */       List<DistributionList> allGroups = prov.getDistributionLists(acct, false, null);
/* 111 */       verifyEquals(expectedAllGroups, allGroups);
/*     */       
/* 113 */       List<DistributionList> directGroups = prov.getDistributionLists(acct, true, null);
/* 114 */       verifyEquals(expectedDirectGroups, directGroups);
/*     */     }
/*     */   }
/*     */   
/*     */   private void getDistributionListById(String id) throws Exception {
/* 119 */     prov.flushCache(CacheEntryType.group, null);
/* 120 */     DistributionList dl = prov.get(Key.DistributionListBy.id, id);
/* 121 */     Assert.assertNotNull(dl);
/* 122 */     Assert.assertEquals(id, dl.getId());
/*     */   }
/*     */   
/*     */   private void getDistributionListByName(String name) throws Exception {
/* 126 */     prov.flushCache(CacheEntryType.group, null);
/* 127 */     DistributionList dl = prov.get(Key.DistributionListBy.name, name);
/* 128 */     Assert.assertNotNull(dl);
/* 129 */     Assert.assertEquals(name, dl.getName());
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void createDistributionList() throws Exception {
/* 134 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart());
/*     */     
/* 136 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART);
/*     */     
/*     */ 
/* 139 */     Server homeServer = dl.getServer();
/* 140 */     Assert.assertNotNull(homeServer);
/*     */     
/* 142 */     deleteDistributionList(dl);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void createDistributionListAlreadyExists() throws Exception {
/* 147 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart());
/* 148 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART);
/*     */     
/* 150 */     boolean caughtException = false;
/*     */     try {
/* 152 */       prov.createDistributionList(dl.getName(), new HashMap());
/*     */     } catch (AccountServiceException e) {
/* 154 */       if ("account.DISTRIBUTION_LIST_EXISTS".equals(e.getCode())) {
/* 155 */         caughtException = true;
/*     */       }
/*     */     }
/* 158 */     Assert.assertTrue(caughtException);
/*     */     
/* 160 */     deleteDistributionList(dl);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void getDistributionList() throws Exception {
/* 165 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart());
/* 166 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART);
/* 167 */     String DL_ID = dl.getId();
/*     */     
/* 169 */     getDistributionListById(dl.getId());
/* 170 */     getDistributionListByName(dl.getName());
/*     */     
/* 172 */     deleteDistributionList(dl);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void renameDistributionList() throws Exception {
/* 177 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart());
/* 178 */     String DL_NEW_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart("new"));
/* 179 */     String DL_NEW_NAME = TestUtil.getAddress(DL_NEW_NAME_LOCALPART, domain.getName()).toLowerCase();
/*     */     
/* 181 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART);
/* 182 */     String DL_ID = dl.getId();
/*     */     
/*     */ 
/* 185 */     Map<String, Object> attrs = Maps.newHashMap();
/* 186 */     attrs.put("zimbraPrefAllowAddressForDelegatedSender", dl.getName());
/* 187 */     prov.modifyAttrs(dl, attrs);
/*     */     
/* 189 */     prov.renameDistributionList(DL_ID, DL_NEW_NAME);
/*     */     
/* 191 */     prov.flushCache(CacheEntryType.group, null);
/* 192 */     getDistributionListById(DL_ID);
/* 193 */     getDistributionListByName(DL_NEW_NAME);
/*     */     
/*     */ 
/* 196 */     DistributionList renamedDl = prov.get(Key.DistributionListBy.name, DL_NEW_NAME);
/* 197 */     Set<String> addrsForDelegatedSender = renamedDl.getMultiAttrSet("zimbraPrefAllowAddressForDelegatedSender");
/* 198 */     Assert.assertEquals(1L, addrsForDelegatedSender.size());
/* 199 */     Assert.assertTrue(addrsForDelegatedSender.contains(DL_NEW_NAME));
/*     */     
/* 201 */     deleteDistributionList(dl);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void renameDistributionListDomainChanged() throws Exception {
/* 206 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart());
/*     */     
/* 208 */     String NEW_DOMAIN_NAME = genDomainSegmentName() + "." + BASE_DOMAIN_NAME;
/* 209 */     Domain newDomain = provUtil.createDomain(NEW_DOMAIN_NAME, null);
/* 210 */     String DL_NEW_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart("new"));
/* 211 */     String DL_NEW_NAME = TestUtil.getAddress(DL_NEW_NAME_LOCALPART, newDomain.getName()).toLowerCase();
/*     */     
/* 213 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART);
/* 214 */     String DL_ID = dl.getId();
/*     */     
/*     */ 
/* 217 */     Map<String, Object> attrs = Maps.newHashMap();
/* 218 */     attrs.put("zimbraPrefAllowAddressForDelegatedSender", dl.getName());
/* 219 */     prov.modifyAttrs(dl, attrs);
/*     */     
/* 221 */     prov.renameDistributionList(DL_ID, DL_NEW_NAME);
/*     */     
/* 223 */     getDistributionListById(DL_ID);
/* 224 */     getDistributionListByName(DL_NEW_NAME);
/*     */     
/*     */ 
/* 227 */     DistributionList renamedDl = prov.get(Key.DistributionListBy.name, DL_NEW_NAME);
/* 228 */     Set<String> addrsForDelegatedSender = renamedDl.getMultiAttrSet("zimbraPrefAllowAddressForDelegatedSender");
/* 229 */     Assert.assertEquals(1L, addrsForDelegatedSender.size());
/* 230 */     Assert.assertTrue(addrsForDelegatedSender.contains(DL_NEW_NAME));
/*     */     
/* 232 */     deleteDistributionList(dl);
/* 233 */     provUtil.deleteDomain(newDomain);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void addMembers() throws Exception {
/* 238 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart());
/* 239 */     String MEMBER_1 = "member_1@test.com";
/* 240 */     String MEMBER_2 = "member_2@test.com";
/* 241 */     String MEMBER_3 = "member_3@test.com";
/* 242 */     String MEMBER_4 = "member_4@test.com";
/*     */     
/* 244 */     Map<String, Object> attrs = new HashMap();
/*     */     
/* 246 */     StringUtil.addToMultiMap(attrs, "zimbraMailForwardingAddress", MEMBER_1);
/* 247 */     StringUtil.addToMultiMap(attrs, "zimbraMailForwardingAddress", MEMBER_2);
/*     */     
/* 249 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART, attrs);
/*     */     
/* 251 */     prov.addMembers(dl, new String[] { MEMBER_3, MEMBER_4 });
/*     */     
/* 253 */     Set<String> allMembers = dl.getAllMembersSet();
/* 254 */     Assert.assertEquals(4L, allMembers.size());
/* 255 */     Assert.assertTrue(allMembers.contains(MEMBER_1));
/* 256 */     Assert.assertTrue(allMembers.contains(MEMBER_2));
/* 257 */     Assert.assertTrue(allMembers.contains(MEMBER_3));
/* 258 */     Assert.assertTrue(allMembers.contains(MEMBER_4));
/*     */     
/* 260 */     deleteDistributionList(dl);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void removeMembers() throws Exception {
/* 265 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart());
/* 266 */     String MEMBER_1 = "member_1@test.com";
/* 267 */     String MEMBER_2 = "member_2@test.com";
/* 268 */     String MEMBER_3 = "member_3@test.com";
/* 269 */     String MEMBER_4 = "member_4@test.com";
/*     */     
/* 271 */     Map<String, Object> attrs = new HashMap();
/*     */     
/* 273 */     StringUtil.addToMultiMap(attrs, "zimbraMailForwardingAddress", MEMBER_1);
/* 274 */     StringUtil.addToMultiMap(attrs, "zimbraMailForwardingAddress", MEMBER_2);
/* 275 */     StringUtil.addToMultiMap(attrs, "zimbraMailForwardingAddress", MEMBER_3);
/* 276 */     StringUtil.addToMultiMap(attrs, "zimbraMailForwardingAddress", MEMBER_4);
/*     */     
/* 278 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART, attrs);
/*     */     
/* 280 */     prov.removeMembers(dl, new String[] { MEMBER_3, MEMBER_4 });
/*     */     
/* 282 */     Set<String> allMembers = dl.getAllMembersSet();
/* 283 */     Assert.assertEquals(2L, allMembers.size());
/* 284 */     Assert.assertTrue(allMembers.contains(MEMBER_1));
/* 285 */     Assert.assertTrue(allMembers.contains(MEMBER_2));
/*     */     
/* 287 */     deleteDistributionList(dl);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void accountInDistributionList() throws Exception {
/* 292 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart());
/* 293 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART);
/* 294 */     String DL_ID = dl.getId();
/*     */     
/* 296 */     String ACCT_NAME_IN_DL_LOCALPART = Names.makeAccountNameLocalPart(genAcctNameLocalPart("acct-in"));
/* 297 */     Account acctInDL = createAccount(ACCT_NAME_IN_DL_LOCALPART);
/* 298 */     String ACCT_NAME_NOT_IN_DL_LOCALPART = Names.makeAccountNameLocalPart(genAcctNameLocalPart("acct-not-in"));
/* 299 */     Account acctNotInDL = createAccount(ACCT_NAME_NOT_IN_DL_LOCALPART);
/*     */     
/* 301 */     prov.addMembers(dl, new String[] { acctInDL.getName() });
/*     */     
/* 303 */     boolean inDL = prov.inDistributionList(acctInDL, DL_ID);
/* 304 */     Assert.assertTrue(inDL);
/*     */     
/* 306 */     inDL = prov.inDistributionList(acctNotInDL, DL_ID);
/* 307 */     Assert.assertFalse(inDL);
/*     */     
/* 309 */     deleteAccount(acctInDL);
/* 310 */     deleteAccount(acctNotInDL);
/* 311 */     deleteDistributionList(dl);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void dlInDistributionList() throws Exception {
/* 316 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart());
/* 317 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART);
/* 318 */     String DL_ID = dl.getId();
/*     */     
/* 320 */     String DL_NAME_IN_DL_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart("dl-in"));
/* 321 */     DistributionList dlInDL = createDistributionList(DL_NAME_IN_DL_LOCALPART);
/* 322 */     String DL_NAME_NOT_IN_DL_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart("dl-not-in"));
/* 323 */     DistributionList dlNotInDL = createDistributionList(DL_NAME_NOT_IN_DL_LOCALPART);
/*     */     
/* 325 */     prov.addMembers(dl, new String[] { dlInDL.getName() });
/*     */     
/* 327 */     boolean inDL = prov.inDistributionList(dlInDL, DL_ID);
/* 328 */     Assert.assertTrue(inDL);
/*     */     
/* 330 */     inDL = prov.inDistributionList(dlNotInDL, DL_ID);
/* 331 */     Assert.assertFalse(inDL);
/*     */     
/* 333 */     deleteDistributionList(dlInDL);
/* 334 */     deleteDistributionList(dlNotInDL);
/* 335 */     deleteDistributionList(dl);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void getAccountDistributionLists() throws Exception {
/* 340 */     String DL_NAME_1_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart("dl-1"));
/* 341 */     String DL_NAME_2_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart("dl-2"));
/* 342 */     DistributionList dl1 = createDistributionList(DL_NAME_1_LOCALPART);
/* 343 */     DistributionList dl2 = createDistributionList(DL_NAME_2_LOCALPART);
/*     */     
/* 345 */     String ACCT_NAME_LOCALPART = Names.makeAccountNameLocalPart(genAcctNameLocalPart("acct"));
/* 346 */     Account acct = createAccount(ACCT_NAME_LOCALPART);
/*     */     
/* 348 */     prov.addMembers(dl1, new String[] { dl2.getName() });
/* 349 */     prov.addMembers(dl2, new String[] { acct.getName() });
/*     */     
/* 351 */     Set<String> dlIds = prov.getDistributionLists(acct);
/* 352 */     Assert.assertEquals(2L, dlIds.size());
/* 353 */     Assert.assertTrue(dlIds.contains(dl1.getId()));
/* 354 */     Assert.assertTrue(dlIds.contains(dl2.getId()));
/*     */     
/* 356 */     Map<String, String> via = new HashMap();
/* 357 */     List<DistributionList> inDlsDirect = prov.getDistributionLists(acct, true, via);
/* 358 */     Assert.assertEquals(1L, inDlsDirect.size());
/* 359 */     Assert.assertEquals(dl2.getId(), ((DistributionList)inDlsDirect.get(0)).getId());
/*     */     
/* 361 */     List<DistributionList> inDlsAll = prov.getDistributionLists(acct, false, via);
/* 362 */     Assert.assertEquals(2L, inDlsAll.size());
/*     */     
/* 364 */     deleteAccount(acct);
/* 365 */     deleteDistributionList(dl1);
/* 366 */     deleteDistributionList(dl2);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void getDlDistributionLists() throws Exception {
/* 371 */     String DL_NAME_1_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart("dl-1"));
/* 372 */     String DL_NAME_2_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart("dl-2"));
/* 373 */     DistributionList dl1 = createDistributionList(DL_NAME_1_LOCALPART);
/* 374 */     DistributionList dl2 = createDistributionList(DL_NAME_2_LOCALPART);
/*     */     
/* 376 */     String DL_NAME_LOCALPART = Names.makeDLNameLocalPart(genGroupNameLocalPart("dl"));
/* 377 */     DistributionList dl = createDistributionList(DL_NAME_LOCALPART);
/*     */     
/* 379 */     prov.addMembers(dl1, new String[] { dl2.getName() });
/* 380 */     prov.addMembers(dl2, new String[] { dl.getName() });
/*     */     
/* 382 */     Map<String, String> via = new HashMap();
/* 383 */     List<DistributionList> inDlsDirect = prov.getDistributionLists(dl, true, via);
/* 384 */     Assert.assertEquals(1L, inDlsDirect.size());
/* 385 */     Assert.assertEquals(dl2.getId(), ((DistributionList)inDlsDirect.get(0)).getId());
/*     */     
/* 387 */     List<DistributionList> inDlsAll = prov.getDistributionLists(dl, false, via);
/* 388 */     Assert.assertEquals(2L, inDlsAll.size());
/*     */     
/* 390 */     deleteDistributionList(dl);
/* 391 */     deleteDistributionList(dl1);
/* 392 */     deleteDistributionList(dl2);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void testCircular1() throws Exception
/*     */   {
/* 398 */     Domain domain = provUtil.createDomain(genDomainSegmentName() + "." + BASE_DOMAIN_NAME);
/*     */     
/* 400 */     DistributionList group1 = provUtil.createDistributionList("group1", domain);
/* 401 */     DistributionList group2 = provUtil.createDistributionList("group2", domain);
/* 402 */     Account acct1 = provUtil.createAccount("acct1", domain);
/* 403 */     Account acct2 = provUtil.createAccount("acct2", domain);
/* 404 */     String acct1Id = acct1.getId();
/* 405 */     String acct2Id = acct2.getId();
/*     */     
/* 407 */     group1.addMembers(new String[] { group2.getName(), acct1.getName(), acct2.getName() });
/* 408 */     group2.addMembers(new String[] { group1.getName(), acct1.getName(), acct2.getName() });
/*     */     
/* 410 */     Set<String> expectedAllGroups = new HashSet();
/* 411 */     Set<String> expectedDirectGroups = new HashSet();
/* 412 */     expectedAllGroups.add(group1.getName());
/* 413 */     expectedAllGroups.add(group2.getName());
/* 414 */     expectedDirectGroups.add(group1.getName());
/* 415 */     expectedDirectGroups.add(group2.getName());
/*     */     
/* 417 */     verifyMembership(acct1Id, expectedAllGroups, expectedDirectGroups);
/* 418 */     verifyMembership(acct2Id, expectedAllGroups, expectedDirectGroups);
/*     */   }
/*     */   
/*     */   @Test
/*     */   public void testCircular2() throws Exception {
/* 423 */     Domain domain = provUtil.createDomain(genDomainSegmentName() + "." + BASE_DOMAIN_NAME);
/*     */     
/* 425 */     DistributionList group1 = provUtil.createDistributionList("group1", domain);
/* 426 */     DistributionList group2 = provUtil.createDistributionList("group2", domain);
/* 427 */     DistributionList group3 = provUtil.createDistributionList("group3", domain);
/* 428 */     Account acct1 = provUtil.createAccount("acct1", domain);
/* 429 */     Account acct2 = provUtil.createAccount("acct2", domain);
/* 430 */     String acct1Id = acct1.getId();
/* 431 */     String acct2Id = acct2.getId();
/*     */     
/* 433 */     group1.addMembers(new String[] { group2.getName(), acct1.getName(), acct2.getName() });
/* 434 */     group2.addMembers(new String[] { group3.getName() });
/* 435 */     group3.addMembers(new String[] { group1.getName() });
/*     */     
/* 437 */     Set<String> expectedAllGroups = new HashSet();
/* 438 */     Set<String> expectedDirectGroups = new HashSet();
/* 439 */     expectedAllGroups.add(group1.getName());
/* 440 */     expectedAllGroups.add(group2.getName());
/* 441 */     expectedAllGroups.add(group3.getName());
/* 442 */     expectedDirectGroups.add(group1.getName());
/*     */     
/* 444 */     verifyMembership(acct1Id, expectedAllGroups, expectedDirectGroups);
/* 445 */     verifyMembership(acct2Id, expectedAllGroups, expectedDirectGroups);
/*     */   }
/*     */   
/*     */   @Test
/*     */   @QA.Bug(bug={42132})
/*     */   public void bug42132()
/*     */     throws Exception
/*     */   {
/* 453 */     Domain domain = provUtil.createDomain(genDomainSegmentName() + "." + BASE_DOMAIN_NAME);
/*     */     
/* 455 */     DistributionList group1 = provUtil.createDistributionList("group1", domain);
/* 456 */     DistributionList group2 = provUtil.createDistributionList("group2", domain);
/* 457 */     Account acct1 = provUtil.createAccount("acct1", domain);
/* 458 */     Account acct2 = provUtil.createAccount("acct2", domain);
/* 459 */     String acct1Id = acct1.getId();
/* 460 */     String acct2Id = acct2.getId();
/*     */     
/* 462 */     group2.addMembers(new String[] { group1.getName() });
/*     */     
/*     */ 
/* 465 */     Map<String, Object> attrs = Maps.newHashMap();
/* 466 */     attrs.put("+zimbraMailForwardingAddress", group2.getName());
/* 467 */     prov.modifyAttrs(group2, attrs);
/*     */     
/* 469 */     group1.addMembers(new String[] { acct1.getName(), acct2.getName() });
/*     */     
/* 471 */     Set<String> expectedAllGroups = new HashSet();
/* 472 */     Set<String> expectedDirectGroups = new HashSet();
/* 473 */     expectedAllGroups.add(group1.getName());
/* 474 */     expectedAllGroups.add(group2.getName());
/* 475 */     expectedDirectGroups.add(group1.getName());
/*     */     
/* 477 */     verifyMembership(acct1Id, expectedAllGroups, expectedDirectGroups);
/* 478 */     verifyMembership(acct2Id, expectedAllGroups, expectedDirectGroups);
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/prov/ldap/TestLdapProvDistributionList.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */